from wordcloud import WordCloud
import numpy as np
from PIL import Image
mask1=np.array(Image.open("111.png")) #读取为nd-array类型，以传递给mask参数
with open('ciku.txt', 'r', encoding='utf-8') as file:
    text = file.read()
wc = WordCloud(font_path = "C:\Windows\Fonts\simhei.ttf",background_color="white", width=800,  height=600, max_words=200,mask = mask1)
wc.generate(text)
wc.to_file('数据分析.png')
